/*************************************************************************
	> File Name: dasserver.h
	> Author: xuwenlong
	> Mail: myxuan475@126.com 
	> Created Time: 2018年09月17日 星期一 14时00分10秒
 ************************************************************************/

#ifndef __DASSERVER_H__
#define __DASSERVER_H__
#include <event.h>
#include "client.h"
#include <vector>
#include <utils/shared_ptr.h>
#include <transport/remote/server/server.h>
#include <transport/remote/server/user.h>
#include <map>

class Exchange;

using namespace std;

class DasServer:public Server
{
public:
    DasServer(Exchange *ex);
    virtual ~DasServer();

    virtual tUser CreateUser();
    virtual void ClearUsers();
    virtual void AddUser(tUser user);
    virtual void TimeOutEvent(int fd, short ev);

    void addCompany(const string &company,const string &strid,tUser tu);

    Exchange *Ex();

    DAS_RESULT getAcquisitorList(
            const Json::Value &params,
            Json::Value &result);

    tUser FindClient(const std::string &strId);
    virtual bool Compare(
            int flag, tUser user,
            const void *arg);

    string Report(const string &mark);
private:
    Exchange *m_pEx;
    Lock      m_lock;
    map<string,map<string,tUser> > m_listcompany;

//    Lock  m_unknownlock;
    vector<tUser> m_listunknown;
};

#endif
